import Vue from 'vue'
import map from './index.vue'

const googleMap = (params, callback) => {
  const mapConstructor = Vue.extend(map)
  const instance = new mapConstructor({
    el: document.createElement('div')
  })
  document.body.appendChild(instance.$el)
  instance.$data.show = true
  instance.$data.province = params.province || ''
  instance.$data.distrange = params.distrange || ''
  instance.$data.searchName = params.searchName
  instance.$data.lat = params.lat
  instance.$data.lng = params.lng
  instance.callback = callback
}

export default function(Vue) {
  Vue.prototype.$googleMap = googleMap
}
